package com.hdax.dm.controller;

import com.hdax.dm.exceptions.DmException;
import com.hdax.dm.service.submitorderService;
import com.hdax.dm.utils.response.CommonResponse;
import com.hdax.dm.utils.response.ResponseUtil;
import com.hdax.dm.vo.submitorderVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
@RequestMapping("/order")
public class submitorderController {

    @Autowired
    private submitorderService submitorderService;
    /**
     * 获取用户提交的订单信息
     * 下单接口
     */
    @PostMapping("submitorder")
    public CommonResponse<Map<String,String>> submitorder(@RequestBody submitorderVo vo, HttpServletRequest request){
        return submitorderService.submitorder(vo,request);
    }

//    //局部异常处理
//    @ExceptionHandler(value = {DmException.class})
//    public CommonResponse<String> exceptionHandler(DmException e){
//        return ResponseUtil.returnFail(e);
//    }
}
